package com.lx.demo3;

public class Main {
    public static void main(String[] args) {
        //要被代理的对象：真实角色
        UserServiceImpl userService = new UserServiceImpl();
        //代理角色
        ProxyInvocationHandler invocationHandler = new ProxyInvocationHandler();
        //设置要代理的对象
        invocationHandler.setTarget(userService);
        //动态生成代理类
        UserService proxy = (UserService) invocationHandler.getProxy();
        proxy.add();
    }
}
